package godis

type Iterator struct {
	Data  []interface{}
	Index int
}

func NewIterator(data []interface{}) *Iterator {
	return &Iterator{
		Data:  data,
		Index: 0,
	}
}

func (self *Iterator) HasNext() bool {

	if self.Data == nil || len(self.Data) < 0 {
		return false
	}

	return self.Index < len(self.Data)
}

func (self *Iterator) Next() (resp interface{}) {
	resp = self.Data[self.Index]
	self.Index = self.Index + 1
	return resp

}
